package com.haixinga.commbiz.commons.utils;

/**
 * 十六进制 工具类
 * @author Terrfly
 *
 */
public class HexKit {

	/**
	 * byte2HexStr byte 转换为string
	 * @param b
	 * @return
	 */
	public static String byte2HexStr(byte[] b) {
		String result = "";
		try {
			StringBuffer md5StrBuff = new StringBuffer();
			for (int i = 0; i < b.length; i++) {
				if (Integer.toHexString(0xFF & b[i]).length() == 1)
					md5StrBuff.append("0").append(Integer.toHexString(0xFF & b[i]));
				else
					md5StrBuff.append(Integer.toHexString(0xFF & b[i]));
			}
			result = md5StrBuff.toString().toUpperCase();

		} catch (Exception e) {
		}
		return result;

	}

}
